package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.anno.RpcConsumerService;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @RpcConsumerService
    private IUserService userService;

    @GetMapping("/user")
    public Object getUserById(Integer id) {
        User user = userService.getById(id);
        return "来自服务器：[" + user.getFromPort() + "]的返回结果：" + user;
    }
}
